/*
 * TCPSocketSSLRev.h
 *
 *  Created on: 2011-3-5
 *      Author: lionxing
 */

#ifndef TCPSOCKETSSLREV_H_
#define TCPSOCKETSSLREV_H_
#include <e32base.h>
#include <es_sock.h>
#include <in_sock.h>
#include <SecureSocket.h> 
const TInt KBuffSizeSOCKETSSL = 1024*8;

class MObserverRevSSL
{
public:
	virtual void OnReceiveSSL(const TDesC8& aData, TInt aError) = 0;
};

class CTCPSocketSSLRev : public CActive
{
public: // Observer interface

public:
	// C++ constructor
	CTCPSocketSSLRev(MObserverRevSSL& aObserver, CSecureSocket* aSocket);
	
	// Cancel and destroy
	~CTCPSocketSSLRev();

public: // New functions
	// Function for making the initial request
	// void Start(TTimeIntervalMicroSeconds32 aDelay);


private: // From CActive
	// Handle completion
	void RunL();
	void DoCancel();

public: // New functions
	void Receive();
private: // member variables
	MObserverRevSSL& iObserver;
	TSockXfrLength      iLen;
	TUint8*             iBuffPtr;
	TPtr8               iRecvBuf;       //一定要作为类变量, 否则socket的实现会出现core dump

	CSecureSocket*      iSSLRev;
};
#endif
